<template>
  <el-card class="box-card">
  <div slot="header" class="clearfix">
    <shopee-table stripe :data="taskInstanceVariableTable">
      <shopee-table-column prop="key" label="Key" :width="200">
      </shopee-table-column>

      <shopee-table-column label="内容" :width="800" fixed="right">
        <template slot-scope="props">
          <json-editor v-model="props.row.value"></json-editor>
        </template>
      </shopee-table-column>
    </shopee-table>
  </div>
  </el-card>
  </template>

  <script>
    import {api, getRequest, postRequest} from "@/api/commit";
    import JsonEditor from '@/components/JsonEditor'
    import 'codemirror/addon/lint/lint'
    import 'codemirror/addon/lint/lint.css'
    import 'codemirror/addon/lint/json-lint'
    import 'codemirror/addon/display/autorefresh' //及时自动更新，配置里面也需要设置autoRefresh为true

    export default {
      name : "taskInstanceVariableTable",
      components: {
        JsonEditor
      },
      data() {
        return {
          taskInstanceVariableTable: [],
        }
      },
      methods: {
        init_data() {
          let params ={
            "id": this.$route.query.id
          }
          getRequest(api['task_instance_param_list'],params).then((res) => {
            res = res.resultReturn
            this.taskInstanceVariableTable= res.data
          }, (error) => {
            console.info(error)
          })
        }
      },
      mounted () {
        this.init_data()
      }
    }
  </script>
